<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI</title>
<link rel="stylesheet" type="text/css" href="#{$smarty.const.APP}#/View/templates/app/css/hui.css" />
<style type="text/css">
.hui-tab-item {
	border: 0px;
}
</style>
</head>
<body>
<header class="hui-header">
  <div id="hui-back"></div>
  <h1>HUI 选项卡</h1>
</header>
<div class="hui-wrap">
  <div class="hui-common-title">
    <div class="hui-common-title-line"></div>
    <div class="hui-common-title-txt">选项卡演示</div>
    <div class="hui-common-title-line"></div>
  </div>
  <div style="padding:28px 0px 28px;">
    <div class="hui-tab">
      <div class="hui-tab-title">
        <div>新闻</div>
        <div>热点</div>
        <div>体育</div>
        <div>聚焦</div>
      </div>
      <div class="hui-tab-body">
        <div class="hui-tab-body-items">
          <div class="hui-tab-item hui-list"> 
					<div id="refreshContainer" class="hui-refresh">
						<div class="hui-refresh-icon"></div>
						<div class="hui-refresh-content hui-list">
							<ul id="list"></ul>
						</div>
					</div> 
				</div>
          <div class="hui-tab-item hui-list"> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">第2个选项卡对应内容，凑几个字。</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">习近平对新闻工作者提出4点希望</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">李克强访问圣彼得堡总理见17国领导人</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">英媒:释法系香港终结的开始 外交部:谢绝干涉</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">西安地铁三号线乘车全攻略：也有“区间车”</div>
            </a> </div>
          <div class="hui-tab-item hui-list"> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">第3个选项卡对应内容，凑几个字。</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">习近平对新闻工作者提出4点希望</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">李克强访问圣彼得堡总理见17国领导人</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">英媒:释法系香港终结的开始 外交部:谢绝干涉</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">西安地铁三号线乘车全攻略：也有“区间车”</div>
            </a> </div>
          <div class="hui-tab-item hui-list"> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">第4个选项卡对应内容，凑几个字。</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">习近平对新闻工作者提出4点希望</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">李克强访问圣彼得堡总理见17国领导人</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">英媒:释法系香港终结的开始 外交部:谢绝干涉</div>
            </a> <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">西安地铁三号线乘车全攻略：也有“区间车”</div>
            </a> </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="#{$smarty.const.APP}#/View/templates/app/js/hui.js" type="text/javascript" charset="utf-8"></script> 
<script src="#{$smarty.const.APP}#/View/templates/app/js/hui-tab.js" type="text/javascript"></script> 
<script src="#{$smarty.const.APP}#/View/templates/app//js/hui-refresh-load-more.js" type="text/javascript"></script>
<script type="text/javascript">
hui.tab('.hui-tab');
</script>
<script type="text/javascript">
var page = 1;
hui.refresh('#refreshContainer', refresh);
hui.loadMore(getMore);
//加载更多
function getMore(){
    hui.get(
        'http://hoa.hcoder.net/index.php?user=hcoder&pwd=hcoder&m=list1&page='+page,
        function(res){
            //判断加载完毕
            if(res == 'null'){
                hui.endLoadMore(true, '已经到头了...');
                return false;
            }
            var data = res.split('--hcSplitor--');
            for(var i = 0; i < data.length; i++){
                var li = document.createElement('li');
                li.innerHTML = '<div class="hui-list-text">'+data[i]+'</div>';
                hui(li).appendTo('#list');
            }
            page++;
            hui.endLoadMore();
        }
    );
}

//下拉刷新
function refresh(){
    hui.loading('加载中...');
    hui.get(
        'http://hoa.hcoder.net/index.php?user=hcoder&pwd=hcoder&m=list1&page=1',
        function(res){
            hui.closeLoading();
            var data = res.split('--hcSplitor--');
            var html = '';
            for(var i = 0; i < data.length; i++){
                html += '<a href="javascript:hui.toast(\'hi.....\');"><div class="hui-list-text">'+data[i]+'</div></a>';
            }
            page = 2;
            hui('#list').html(html);
            //结束刷新
            hui.endRefresh();
            //重置加载更多状态
            hui.resetLoadMore();
        },
        function(){
            hui.closeLoading();
            hui.upToast('连接服务器失败！');
            hui.endRefresh();
        }
    );
}
</script>
</body>
</html>